﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ManufacturerMostWarranty.ascx.cs" Inherits="CS424_9pts.Administration.Modules.ManufacturerMostWarranty" %>
<%@ Register TagPrefix="AdminUC" TagName="ToolTipLabel" Src="ToolTipLabelControl.ascx" %>
<%@ Register TagPrefix="AdminUC" TagName="SimpleTextBox" Src="SimpleTextBox.ascx" %>
<%@ Register TagPrefix="AdminUC" TagName="DatePicker" Src="DatePicker.ascx" %>

<div class="section-header">
    <div class="title">
        <img src="Common/ico-sales.png" alt="Most Warranty Report" />    
    </div>
    <div class="options">
    </div>
</div>

<asp:SqlDataSource  ID="SqlDataManufacturerMostWarranty" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>"
                    SelectCommand="SELECT Brand.BrandName AS Manufacturer, COUNT(*) AS WarrantyNumber FROM Warranty INNER JOIN Contract ON Warranty.ContractID = Contract.ContractID INNER JOIN Car ON Contract.CarID = Car.CarID INNER JOIN CarModel ON Car.CarModel = CarModel.ModelID INNER JOIN Brand ON CarModel.BrandID = Brand.BrandID GROUP BY Brand.BrandName" 
    DeleteCommand="DELETE FROM [Maintenance] WHERE [MaintenanceID] = @MaintenanceID" 
    InsertCommand="INSERT INTO [Maintenance] ([ContractID], [Date], [Description], [Subtotal], [TaxID], [Total], [CurrencyID], [Status]) VALUES (@ContractID, @Date, @Description, @Subtotal, @TaxID, @Total, @CurrencyID, @Status)" 
    
    
    UpdateCommand="UPDATE [Maintenance] SET [ContractID] = @ContractID, [Date] = @Date, [Description] = @Description, [Subtotal] = @Subtotal, [TaxID] = @TaxID, [Total] = @Total, [CurrencyID] = @CurrencyID, [Status] = @Status WHERE [MaintenanceID] = @MaintenanceID">
    <DeleteParameters>
        <asp:Parameter Name="MaintenanceID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="ContractID" Type="Int32" />
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Subtotal" Type="Double" />
        <asp:Parameter Name="TaxID" Type="Int32" />
        <asp:Parameter Name="Total" Type="Double" />
        <asp:Parameter Name="CurrencyID" Type="Int32" />
        <asp:Parameter Name="Status" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="ContractID" Type="Int32" />
        <asp:Parameter Name="Date" Type="DateTime" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="Subtotal" Type="Double" />
        <asp:Parameter Name="TaxID" Type="Int32" />
        <asp:Parameter Name="Total" Type="Double" />
        <asp:Parameter Name="CurrencyID" Type="Int32" />
        <asp:Parameter Name="Status" Type="Int32" />
        <asp:Parameter Name="MaintenanceID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

<asp:GridView ID="gvBrandCount" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataSourceID="SqlDataManufacturerMostWarranty" ForeColor="#333333" 
    GridLines="None">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="Manufacturer" HeaderText="Manufacturer" 
            SortExpression="Manufacturer" />
        <asp:BoundField DataField="WarrantyNumber" HeaderText="WarrantyNumber" 
            ReadOnly="True" SortExpression="WarrantyNumber" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>